<template>
  <el-form ref="form" :model="formData" label-width="80px">
    <el-form-item label="资讯标题">
      <el-input v-model="formData.title"></el-input>
    </el-form-item>
    <el-form-item label="资讯类型">
      <el-input v-model="formData.type"></el-input>
    </el-form-item>
    <el-form-item label="资讯内容">
      <el-input v-model="formData.content"></el-input>
    </el-form-item>
    <el-form-item label="资讯发表人">
      <el-input v-model="formData.author"></el-input>
    </el-form-item>
    <el-form-item label="资讯发表时间">
      <el-input v-model="formData.pubtime"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submit(formData)">提交</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import { reactive } from "@vue/reactivity";
export default {
  setup() {
    let formData = reactive({
      id: "",
      title: "",
      type: "",
      content: "",
      pubtime: "",
      author: "",
    });

    function submit(data) {
      // 向服务器发送请求
      console.log(data);
    }

    return { formData, submit };
  },
};
</script>